package com.luge.model.view;

import android.content.Context;
import android.graphics.Bitmap;
import android.util.AttributeSet;
import android.widget.ImageView;

public class CustomImageView extends ImageView {
	private Bitmap bitmap;

	public CustomImageView(Context context) {
		super(context);
	}

	public CustomImageView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public CustomImageView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	public void release() {
		if (bitmap != null) {
			setImageBitmap(null);
			bitmap.recycle();
			bitmap = null;
		}
	}

	public void setBitmap(Bitmap bitmap) {
		if (bitmap != null) {
			this.bitmap = bitmap;
			setImageBitmap(bitmap);
		}
	}

	public Bitmap getBitmap() {
		return bitmap;
	}

}
